<!--
 * @Date: 2024-01-19 17:39:10
 * @LastEditors: wy
 * @LastEditTime: 2024-01-21 18:27:10
 * @FilePath: \商城\src\framework\commonTemplate\wptx_page.vue
-->
<template>
  <div class="block pagination">
    <el-pagination :current-page="pageData.pageNo" :page-sizes="pageData.pageSizes" :page-size="pageData.pageSize"
      layout="total, sizes, prev, pager, next, jumper" :total="pageData.totalCount" @size-change="pageSizeChange"
      @current-change="pageNoChange" />
  </div>
</template>
<script>

import _common from '../commonJs/wptx_common'

export default {
  props: {},
  data() {
    return {
      pageData: {
        pageNo: _common.page_common.PAGE_NO,
        pageSize: _common.page_common.PAGE_SIZE,
        totalCount: 1,
        pageSizes: [10, 20, 50, 100]
      },
      otherData: {}
    }
  },
  methods: {
    pageSizeChange(val) {
      const self = this
      self.pageData.pageNo = 1
      self.pageData.pageSize = val
      self.search()
    },
    pageNoChange(val) {
      const self = this
      self.pageData.pageNo = val
      self.pageData.pageSize = self.pageData.pageSize
        ? self.pageData.pageSize
        : 10
      self.search()
    },
    search() {
      const self = this
      this.$emit('search', self.pageData)
    },
    updatePageData(data) {
      console.log(data, '00');
      this.pageData = {...this.pageData,...data}
    },
    resetPageNo() {
      const self = this
      self.pageData.pageNo = _common.page_common.PAGE_NO
    }
  }
}
</script>
